package com.atguigu.jxc.controller;


import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.CustomerReturnList;
import com.atguigu.jxc.service.CustomerReturnListGoodsService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/customerReturnListGoods")
public class CustomerReturnListGoodsController {

    @Autowired
    private CustomerReturnListGoodsService customerReturnListGoodsService;

    @RequestMapping("/save")
    @RequiresPermissions(value = "客户退货")
    public ServiceVO save (CustomerReturnList customerReturnList,String customerReturnListGoodsStr){
        return customerReturnListGoodsService.save(customerReturnList,customerReturnListGoodsStr);
    }
    @RequestMapping("/list")
    @RequiresPermissions(value = {"客户退货查询","客户统计"},logical = Logical.OR)
    public Map<String,Object> list (String returnNumber,Integer customerId,Integer state,String sTime,String eTime){
        return customerReturnListGoodsService.list(returnNumber,customerId,state,sTime,eTime);
    }

    @RequestMapping("/goodsList")
    @RequiresPermissions(value = {"客户退货查询","客户统计"},logical = Logical.OR)
    public Map<String,Object> goodsList (Integer customerReturnListId){
        return customerReturnListGoodsService.goodsList(customerReturnListId);
    }

    @RequestMapping("/delete")
    @RequiresPermissions(value = "客户退货查询")
    public ServiceVO delete (Integer customerReturnListId){
        return customerReturnListGoodsService.delete(customerReturnListId);
    }

    @RequestMapping("/count")
    @RequiresPermissions(value = "商品销售统计")
    public String count(String sTime, String eTime, Integer goodsTypeId, String codeOrName) {
        return customerReturnListGoodsService.count(sTime, eTime, goodsTypeId, codeOrName);
    }


}

